package guet.dream.user;

import guet.dream.db.DatabaseUtils;
import guet.dream.question.Question;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;

public class UserDaoImpl implements UserDao {
	

	 

	public User findById(String id) {
/*		int userid = new Integer(id).intValue();
		String sid;
		String name;
		String password;
		String email;
		String sex;
		
		User user;
		
		Connection con = DatabasesUtils.getConnection();
		String queryString = "select * from users where id = ? ";
		try {
			PreparedStatement pstmt = con.prepareStatement(queryString);
			
			pstmt.setInt(1, userid);
			
			ResultSet  rs = pstmt.executeQuery();
			while(rs.next()){
					sid = rs.getString("sid");
					name = rs.getString("name");
					password = rs.getString("password");
					email = rs.getString("email");
					sex = rs.getString("sex");
				 
					user = new User(userid,sid,name,password,email,sex);
					
					return user;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		return null;
	}

}
